﻿function InitializeTweetCraftOptions(panel)
	-- Initialize values
	TweetCraftOptionsPanelShowMinimapButton:SetChecked(tweetCraftOptions.ShowMinimapButton)

	-- Hook the set function
	TweetCraftOptionsPanelShowMinimapButton.setFunc = function(value)
		tweetCraftOptions.ShowMinimapButton = value == "1"

		-- Perform the actual Show/Hide
		if tweetCraftOptions.ShowMinimapButton then
			TweetCraftMinimapButton:Show()
		else
			TweetCraftMinimapButton:Hide()		
		end
	end
end

function TweetCraftOptionsPanel_Event(panel, event, ...)
	local arg1 = ...
	
	if event == "ADDON_LOADED" and arg1 == "TweetCraft" then
		-- Initialize options (values have been loaded)
		InitializeTweetCraftOptions(panel)
		
		-- Add the panel as an options category
		InterfaceOptions_AddCategory(panel)
		
		-- Create checkboxes for AutoTweet addons and categories (options have been loaded)
		-- CreateAutoTweetOptions(AutoTweetOptionsPanel)
		
		-- Add the AutoTweet panel as an options category
		InterfaceOptions_AddCategory(AutoTweetOptionsPanel)
	end
end

